package calendar

import (
	"longmen/server/pkg/common/lunar/BoneUtil"
)

type BoneWeight struct {
	// 开始年(含)
	Year int
	// 月
	Month int
	//日(含)
	Day int
	//时
	Hour string
}

func NewBoneWeight(year, month, day int, hour string) *BoneWeight {
	return &BoneWeight{
		Year:  year,
		Month: month,
		Day:   day,
		Hour:  hour,
	}
}

func (b *BoneWeight) GetBoneWeight() int {
	return b.GetYearBoneWeight() + b.GetMonthBoneWeight() + b.GetDayBoneWeight() + b.GetHourBoneWeight()
}

func (b *BoneWeight) GetYearBoneWeight() int {
	v, ok := BoneUtil.Year_Weight[b.Year]
	if !ok {
		return 0
	}
	return v
}

func (b *BoneWeight) GetMonthBoneWeight() int {
	v, ok := BoneUtil.Month_Weight[b.Month]
	if !ok {
		return 0
	}
	return v
}

func (b *BoneWeight) GetDayBoneWeight() int {
	v, ok := BoneUtil.Day_Weight[b.Day]
	if !ok {
		return 0
	}
	return v
}

func (b *BoneWeight) GetHourBoneWeight() int {
	v, ok := BoneUtil.Hour_Weight[b.Hour]
	if !ok {
		return 0
	}
	return v
}
